package com.chenfan.filestore.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.data.annotation.Transient;

import java.util.Date;

/**
 * 任务表(Task)表实体类
 *
 * @author Leo
 * @since 2023-04-27 11:46:11
 */
@EqualsAndHashCode(callSuper = true)
@SuppressWarnings("serial")
@Data
@TableName(value = "batch_task")
public class Task extends BaseEntity {



    // 任务执行状态 0待执行 10执行中  20成功 30失败
    public static final int STATUS_TO_DEAL = 0;
    public static final int STATUS_EXECUTING = 10;
    public static final int STATUS_SUCCESS = 20;
    public static final int STATUS_FAIL = 30;
    public static final int PART_SUCCESS = 40;


    //任务id
    @TableId(type = IdType.AUTO)
    private Long taskId;
    //任务名称
    private String taskName;
    //系统id
    private Long systemId;
    private String systemName;
    //模块id
    private Long moduleId;
    private String moduleName;
    //任务类型 1 导出 2导入
    private Integer taskType;
    //模板id
    private Long templateId;
    //最终执行sql
    @TableField("`sql`")
    private String sql;
    //下载文件名
    private String fileName;
    //下载文件url
    private String downFileUrl;
    /**
     * 上传失败文件url
     */
    private String failedFileUrl;

    private String failedFileName;

    /**
     * 是否展示图片最大1000条明细展示图片
     */
    private boolean showImage;

    /**
     * 上传文件失败文件名称
     */
    //总记录数
    private Long totalCount;
    //已处理记录数
    private Long alreadyCount;
    //执行开始时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date doTime;
    //执行结束时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date doneTime;
    //执行结果信息
    private String resultMsg;
    //执行异常堆栈
    private String stackTrace;
}

